﻿using System.Collections.Generic;
using HomeWork;

// ---------c1-------------
GenericList<int> intlist = new GenericList<int>();
for(int x = 20;x<30;x++)
{
    intlist.Add(x);
}
// 打印链表元素
intlist.ForEach(Console.WriteLine);

// 求最大值
int max = int.MinValue;
intlist.ForEach(x => { if (x > max) max = x; });
Console.WriteLine("Max: {0}", max);

// 求最小值
int min = int.MaxValue;
intlist.ForEach(x => { if (x < min) min = x; });
Console.WriteLine("Min: {0}", min);

// 求和
int sum = 0;
intlist.ForEach(x => sum += x);
Console.WriteLine("Sum: {0}", sum);

Console.WriteLine("---------c1-------------");

// ---------c2-------------



new Test();

